package com.leetcode.p200;

import java.util.HashSet;
import java.util.Set;

public class Test217 {

    public boolean containsDuplicate(int[] nums) {
        Set<Integer> set = new HashSet<>();

        for (int num : nums) {
            if (set.contains(num)) {
                return true;
            }
            set.add(num);
        }
        return false;
    }

    public static void main(String[] args) {
        int[] arr = new int[]{1, 2, 3, 4};

        Test217 test = new Test217();
        boolean result = test.containsDuplicate(arr);
        System.out.println(result);
    }

}
